package com.xwj.coupon.user.service.handler.excel.amount;

import com.xwj.coupon.user.repository.mysql.entity.CouponTemplateDO;
import lombok.Data;

/**
 * @Author: XuWenjie
 * @Date: 2025-08-21
 * @Description: ComputeAmountHandler
 */
@Data
public abstract class ComputeAmountHandler {

    private CouponTemplateDO couponTemplate;

    public abstract boolean check(CouponTemplateDO couponTemplate,Long amount);

    public abstract Long compute(CouponTemplateDO couponTemplate, Long amount);

    public Long discountAmount(CouponTemplateDO couponTemplate, Long amount){
        if(check(couponTemplate,amount)){
            return compute(couponTemplate,amount);
        }
        return amount;
    }
}
